﻿using System.ServiceModel.Syndication;
using System.Web.Mvc;
using System.Web.Routing;
using System.Xml;
using Sisocana.Core.Models;
using Sisocana.Core.Interfaces;
using Sisocana.Core;

namespace SisocanaFronEnd.Controllers
{
    public class HomeController : SiteController
    {
        public ActionResult Index()
        {
            SiteModel sit = ViewBag.Site;

            foreach (NoticiaAsociadaModel source in Site.sources)
            try
            {
                using (XmlReader reader = XmlReader.Create(source.urlfeed))
                {
                    SyndicationFeed rssData = SyndicationFeed.Load(reader);
                    source.rssFeed = rssData;
                }
            }
            catch { }

            // Galeria de videos
            ViewData["videoKey"] = Site.videoKey.Trim();
            ViewData["videoSize"] = Site.videoSize;
            ViewData["videoTag"] = Site.videoTag.Trim();
            ViewData["videoTipo"] = Site.videoTipo.Trim();
            ViewData["videoWidth"] = Site.videoWidth;
            ViewData["videoHeigth"] = Site.videoHeigth;

            // Galeria de imagenes
            ViewData["imageCant"] = Site.imageCant;
            ViewData["imagekey"] = Site.imagekey.Trim();
            ViewData["imageSecret"] = Site.imageSecret.Trim();
            ViewData["imageTag"] = Site.imageTag.Trim();
            ViewData["imageHeigth"] = Site.imageHeigth;
            ViewData["imageWidth"] = Site.imageWidth;
            ViewData["imageColor"] = Site.imageColor;
            ViewData["imageGallery"] = Site.imageGallery;
                    
            return View();
        }

        public ActionResult About()
        {
            return View();
        }
            

        public ActionResult ContactUs()
        {
            return View();
        }        
    }
}
